<template>
	<view class="beijingse">
		<view class="mainpadding">
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 300rpx;"></view>
			</view>
			<view class="mainpadding ffffff radius" :class="index==0?'':'margin_top'" v-for="(item,index) in list.data" :key="item.id" v-if="index<2">
				<view class="flexleft">
					<view class="touxiang margin_right1">
						<image :src="item.userinfo.avatar" mode=""></image>
					</view>
					<view class="">
						<view class="xiaohei strongtext">{{item.userinfo.nickname}}</view>
						<view class="">
							<u-rate count="5" readonly  v-model="item.lxmy_starnum"></u-rate>
						</view>
					</view>
				</view>
				<view class="xiaohei strongtext margin_top1">{{item.content}}</view>
				<view class="flexleft flex_wrap" style="width: 100%;">
					<view class="flexcenter margin_top" style="width: 16.6%;" @click="lbtpriview(inde,item.images_text)" v-for="(ite,inde) in item.images_text"
						:key="inde">
						<view class="pitup">
							<image :src="ite" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				listid:"",
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			lbtpriview(index, arr) {
				var i = arr; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			init(isPage, page) { //提现记录
				let _this = this;
				let url = '/api/goodscl/goodsCommentIndex'
				httpRequest.request(url, 'GET', {
					page: page || 1,
					limit: _this.limit,
					goods_id: this.listid
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.pitup {
		width: 80rpx;
		height: 80rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	
		image {
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			width: 100%;
			height: 100%;
		}
	}
	
	.touxiang {
		width: 57rpx;
		height: 57rpx;
		border-radius: 50%;
	
		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}
	.shpt {
		width: 197rpx;
		height: 197rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;

		image {
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			width: 100%;
			height: 100%;
		}
	}

	.touxiang {
		width: 57rpx;
		height: 57rpx;
		border-radius: 50%;

		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}

	.shanbj {
		margin-top: 30rpx;
	}

	.shanbj:first-child {
		margin-top: 0rpx;
	}
</style>